package com.card.game.pdk;

import java.util.Date;
import java.util.List;
import java.util.Vector;

import com.card.game.BasePlayer;
import com.card.game.Card;
import com.card.game.playback.Role;
import com.card.game.room.RoomSetting;
import com.google.common.collect.Lists;
import com.xiaoao.net.utils.TimeUtils;

public class PdkPlayBack {
	protected String date;//日期
	public int roomId;//房间id
	public int juNum;//当前局数
	protected List<Role> roles = Lists.newArrayList();//玩家信息 和麻将一样
	protected RoomSetting roomSetting; //房间设置  和麻将一样
	protected String diZhuId;//地主是谁
	protected List<PdkBackEvent> eventList;//每一轮出的牌
	protected List<PdkResult> resultList;//局结束信息是 斗地主正常的局结束信息保存
	protected List<Card> diPai;//新加底牌
	
	public PdkPlayBack() {
		super();
	}

	public PdkPlayBack(PdkRoom room) {
		this.roomSetting = room.getRoomSetting();
		this.roomId = room.getId();
		this.eventList = Lists.newArrayList();
		this.date = TimeUtils.ToString(new Date());
		this.juNum = room.playNum;
		Vector<BasePlayer> players = room.getPlayerList();
		for (int i = players.size()-1; i >= 0; i--) {
			roles.add(new Role((PdkPlayer)players.get(i)));
		}
	}
	
	public void addOutHand(PdkPlayer player,PdkHand hand) {
		this.eventList.add(new PdkBackEvent(player.getTableIndex(), hand));
	}

	public void setDiZhuId(String diZhuId) {
		this.diZhuId = diZhuId;
	}

	public void setResultList(List<PdkResult> resultList) {
		this.resultList = resultList;
	}

	public List<PdkResult> getResultList() {
		return resultList;
	}

	public void setDiPai(List<Card> diPai) {
		this.diPai = diPai;
	}
	
}
